# comment
JFLAGS = 
#JFLAGS = -g
JC = javac
#JC = jikes
.SUFFIXES:  .java .class

.java.class:
	$(JC) $(JFLAGS) $*.java

CLASSES = \
			 Display.class \
			 WindowExiter.class \
			 myJPanel.class \
			 sim2d.class \
			 Sim2dInterpreter.class \
			 Sim2dSymbolTable.class \
			 Sim2dDataType.class \
			 Sim2dException.class \
			 Sim2dInt.class \
			 Sim2dFloat.class \
			 Sim2dBool.class \
			 Sim2dObject.class \
			 Sim2dFunction.class \
			 Sim2dUserFunction.class \
			 Sim2ddistance_to.class \
			 Sim2dbearing_to.class \
			 Sim2darccos.class \
			 Sim2dRule.class \
			 log.class

CLASSES_FROM_GENERATED_CODE = \
			 sim2dLexer.class \
			 sim2dLexerTokenTypes.class \
			 sim2dParser.class \
			 sim2dWalker.class \
			 sim2dLexerTokenTypes.class 
#			 sim2dTokenTypes.class

#default: sim2d.jar

sim2d.jar: ranantlr $(CLASSES_FROM_GENERATED_CODE) $(CLASSES)
	jar cvf $@ $(CLASSES) $(CLASSES_FROM_GENERATED_CODE)

sim2dLexer.class: sim2dLexer.java
sim2dParser.class: sim2dParser.java
sim2dWalker.class: sim2dWalker.java

ranantlr: sim2d.g
	antlr sim2d.g
	touch ranantlr

# -ea turns on assertion
run: sim2d.jar
	java -ea Display

classes: $(CLASSES:.java=.class)

clean:
	rm -f *.class sim2d.jar 
	rm -f *.smap sim2dLexer.java sim2dWalker.java sim2dParser.java
	rm -f sim2dLexerTokenTypes.java sim2dTokenTypes.java 
	rm -f sim2dLexerTokenTypes.txt 
	rm -f ranantlr
